<?php
   // 连接数据库
   include "../../inc/data/conn.php";
// 教学任务查询 1903010328
// 字段如果出现多次，要在段名前面加上表名+.(例如mamx_task.teid)，声明属于哪个表。
$sql = "select classname,tename,coname,cotype,coweekh,coweek,cototalh,coexam 
        from mamx_task,mamx_teacher,mamx_course 
        where taskterm = ? and classname = ?
          and mamx_task.teid = mamx_teacher.teid
          and mamx_task.coid = mamx_course.coid";
if ($stmtTa = $conn->prepare($sql)){
    //  参数赋值
}
    $stmtTa->bind_param("is",$taskterm,$classname);
    $taskterm = $_GET["str1"];
    $classname = $_GET["str2"];
    // 绑定参数
    $stmtTa->bind_result($classname,$tename,$coname,$cotype,$coweekh,$coweek,$cototalh,$coexam);
    $stmtTa->execute();
    // 打印
    $stmtTa->store_result();

   if ($stmtTa->num_rows > 0){
?>
<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
选择的学年学期为： <?=$_GET["str1"]?> <br>
选择的班级为： <?=$_GET["str2"]?> <br>
	<form class="outExc" id="exc">
<div id="dc">
       <input type="button" value="导出EXCEL" class="">
       点击导出EXECL没有反应！！
       </div>
   </form>
	    	    <table>
	    		<tr>
	    			<td>班级名称</td>
	    			<td>任课教师</td>
	    			<td>课程名称</td>
	    			<td>课程类型</td>
	    			<td>周课时</td>
	    			<td>起止周</td>
	    			<td>总课时</td>
	    			<td>考核方式</td>
	    		</tr>
 	<?php
       while($stmtTa->fetch()) {
           echo <<<END
       <tr>
           <td>$classname</td>
           <td>$tename</td>
           <td>$coname</td>
           <td>$cotype</td>
           <td>$coweekh</td>
           <td>$coweek</td>
           <td>$cototalh</td>
           <td>$coexam</td>
       </tr>
END;
     }
     ?>
   </table>
   <?php   
   }
   else{
     echo "查询结果为空，无此选项！";
   }
   ?>
</body>
</html>